// exports.index = function(req, res) {
//   res.render('index', { title: '首页' })
// }

// exports.getPost = function(req, res) {
//   console.log(req.body)
//   res.data = req.body
// }

const express = require('express')
const router = express.Router()

router.get('/', function(req, res) {
  res.render('index', { title: '首页' })
})

router.post('/api/post-data', function(req, res) {
  console.log(req.body)

  res.json({
    hello: req.body,
    message: 'hello world'
  })
})

module.exports = router
